<?php

namespace DesignModel\decorator;
/**
 * Created by PhpStorm.
 * User: 554665488
 * Date: 2018-6-20
 * Time: 21:16
 * @description: 颜色装饰器
 * @Author: yfl
 * @QQ 554665488
 */

class ColorDecorator implements DecoratorApi
{
    protected $color;

    public function __construct($color = 'red')
    {
        $this->color = $color;
    }


    //实现(改变)画图类的中画图之前的方法

    public function beforeDraw()
    {
        echo "<div style='color: {$this->color}'>";
    }

    //实现画图类中画图之后的方法
    public function afterDraw()
    {
        echo "</div>";
    }
}